package com.ldq.imooc.basics.multiThread;

/**
 * @Author : 李道泉
 * @Description :
 * @Date : 2018/4/23 20:35
 * @Modified by :
 */
public class Actor extends Thread {

    /**
     * @Author : 李道泉
     * @Description :
     * @Date 2018/4/23 20:36
     * @Modified by :
     */

    @Override
    public void run() {

        System.out.println(getName() + "：天王盖地虎");
        int count = 0;

        boolean keepRun = true;
        while (keepRun) {

            System.out.println(getName() + "：滴~~滴滴 : " + (++count));
            if (count == 25) {
                keepRun = false;
            }
            if (count % 2 == 0) {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }

        System.out.println(getName() + "：小鸡炖蘑菇");
    }
}
